package com.link2room.optimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * 基础酒店日历
 * Created by sss on 2016/8/25.
 */
@Entity
@Table(name = "base_hotel_calendar",catalog = "")
@DynamicInsert
public class BaseHotelCalendar extends BaseEntity {
    public enum BaseHotelCalendar_{
        priceDate,weekd,level
    }

    /**
     * 日期
     */
    private Date priceDate;
    /**
     * 星期
     */
    private Integer weeked;
    /**
     * 优先级
     */
    private Integer level;

    @Basic
    @Column(name = "price_date", nullable = false)
    public Date getPriceDate() {
        return priceDate;
    }

    public void setPriceDate(Date priceDate) {
        this.priceDate = priceDate;
    }

    @Basic
    @Column(name = "weeked", nullable = true)
    public Integer getWeeked() {
        return weeked;
    }

    public void setWeeked(Integer weeked) {
        this.weeked = weeked;
    }

    @Basic
    @Column(name = "level", nullable = true)
    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BaseHotelCalendar that = (BaseHotelCalendar) o;

        if (priceDate != null ? !priceDate.equals(that.priceDate) : that.priceDate != null) return false;
        if (weeked != null ? !weeked.equals(that.weeked) : that.weeked != null) return false;
        if (level != null ? !level.equals(that.level) : that.level != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = priceDate != null ? priceDate.hashCode() : 0;
        result = 31 * result + (weeked != null ? weeked.hashCode() : 0);
        result = 31 * result + (level != null ? level.hashCode() : 0);
        return result;
    }
}
